package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;

import com.heima.apis.admin.AdSensitiveControllerApi;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/v1/sensitive")
@Api(value = "敏感词管理",tags = "敏感词管理-AdSenstive",description = "敏感词管理API")
public class AdSenstiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService;

    @PostMapping("/list")
    @Override
    @ApiOperation(value = "条件分页查询敏感词列表")
    public ResponseResult list(SensitiveDto dto) {
        return adSensitiveService.list(dto);
    }

    @PostMapping("/save")
    @Override
    @ApiOperation(value = "新增敏感词")
    public ResponseResult insert(AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    @PutMapping("/update")
    @Override
    @ApiOperation(value = "修改敏感词")
    public ResponseResult update(AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }
    @DeleteMapping("/del/{id}")
    @Override
    @ApiOperation(value = "根据id删除敏感词")
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return adSensitiveService.delete(id);
    }
}
